<?php
class AddBook extends Zend_Form {
	
	private $book;
	
	public function AddBook($book) {
		$this->book = $book;
		$this->__construct();
	}
	
	public function init() {
		$this->setMethod("POST");
		$this->setName("PassBookInfo");
		$element = new Zend_Form_Element_Hidden("ASIN");
		$element->setValue($this->book->ASIN);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("source");
        $element->setValue($this->book->source);
        $element->removeDecorator('Label');
        $this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("detail_page_url");
		$element->setValue($this->book->detail_page_url);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("name");
		$element->setValue($this->book->name);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("description");
		$element->setValue($this->book->description);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("ISBN");
		$element->setValue($this->book->ISBN);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("ISBN13");
		$element->setValue($this->book->ISBN13);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("small_image");
		$element->setValue($this->book->small_image);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("medium_image");
		$element->setValue($this->book->medium_image);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("large_image");
		$element->setValue($this->book->large_image);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("currency");
		$element->setValue($this->book->currency);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("amount");
		$element->setValue($this->book->amount);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("author");
		$element->setValue($this->book->author);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("binding");
		$element->setValue($this->book->binding);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("manufacturer");
		$element->setValue($this->book->manufacturer);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("number_of_pages");
		$element->setValue($this->book->number_of_pages);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("publication_date");
		$element->setValue($this->book->publication_date);
		$element->removeDecorator('Label');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("publisher");
		$element->removeDecorator('Label');
		$element->setValue($this->book->publisher);
		$this->addElement($element);
        
		$this->addDisplayGroup(array('publisher', 'publication_date','number_of_pages','manufacturer',
		'binding','author','amount','currency','large_image','medium_image','small_image',
		'ISBN13','ISBN','description','name','detail_page_url','ASIN'),'hiddenBookInfo')->removeDecorator('Label');;
		
//		$element = new Zend_Form_Element_Hidden("release_date");
//		$element->removeDecorator('Label');
//		$element->setValue($this->book->release_date);
//		$this->addElement($element);
		
		$element = new Zend_Form_Element_MultiCheckbox("condition");
		$element->setLabel("Condition");
		$element->setMultiOptions(array(
			"1" => "New",
			"2" => "Used",
			"3" => "EBook"
		));
	//	$element->removeDecorator('Label');
		$element->setSeparator('');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_MultiCheckbox("usage");
		$element->setLabel("Usage");
		$element->setMultiOptions(array(
			"1" => "For sale",
			"2" => "For rent",
			"3" => "For exchange",
			"4" => "For giveaway"
		));
	//	$element->removeDecorator('Label');
		$element->setSeparator('');
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Textarea("note");
		$element->setAttrib('rows', 3)->setAttrib('cols', 30);
		        $element->setDescription('Describe more about this book\'s situation, e.g - "How much do you sell it?"  - "Which kind of book do you want to exchange?" - "How to rent it?"');
		$element->setLabel("Message");
        $this->addElement($element);
		
		$element = new Zend_Form_Element_Submit("add");
		$element->setLabel("add");
		$element->removeDecorator('Label');
		$this->addElement($element);
		
	}
}
?>